<layout name="Common/layout"/>


<link rel="stylesheet" href="__PUBLIC__/Home/style/list.css" type="text/css">
<link rel="stylesheet" href="__PUBLIC__/Home/style/common.css" type="text/css">
<script type="text/javascript" src="__PUBLIC__/Home/js/list.js"></script>

<include file="Common/nav"/>

<style>
    .page{text-align: right;}
    .page ul li {float:left;text-align: center}
</style>
<!-- 列表主体 start -->
<div class="list w1210 bc mt10">
    <!-- 面包屑导航 start -->
    <div class="breadcrumb">
        <h2>当前位置：<a href="">首页</a> > <a href="">电脑、办公</a></h2>
    </div>
    <!-- 面包屑导航 end -->

    <!-- 左侧内容 start -->
    <div class="list_left fl mt10">

        <div style="clear:both;"></div>

        <!-- 新品推荐 start -->
        <div class="newgoods leftbar mt10">
            <h2><strong>新品推荐</strong></h2>
            <div class="leftbar_wrap">
                <ul>
                    <?php foreach($goods4 as $k => $v): ?>
                    <li>
                        <dl>
                            <dt><a href="<?php echo U('Index/goods?id='.$v['id']); ?>"><?php showImage($v['mid_logo']); ?></a></dt>
                            <dd><a href="<?php echo U('Index/goods?id='.$v['id']); ?>"><?php echo $v['goods_name'];?></a></dd>
                            <dd><strong>￥<?php echo $v['shop_price'];?></strong></dd>
                        </dl>
                    </li>
                    <?php endforeach; ?>
                </ul>
            </div>
        </div>
        <!-- 新品推荐 end -->

        <!-- 最近浏览 start -->
        <div class="viewd leftbar mt10">
            <h2><a href="">清空</a><strong>最近浏览过的商品</strong></h2>
            <div class="leftbar_wrap" id="display_history"></div>
        </div>
        <!-- 最近浏览 end -->
    </div>
    <!-- 左侧内容 end -->

    <!-- 列表内容 start -->
    <div class="list_bd fl ml10 mt10">
        <!-- 热卖、促销 start -->
        <div class="list_top">
            <!-- 热卖推荐 start -->
            <div class="hotsale fl">
                <h2><strong><span class="none">热卖推荐</span></strong></h2>
                <ul>
                    <?php foreach($goods3 as $k=>$v):?>
                    <li>
                        <dl>
                            <dt><a href="<?php echo U('goods?id='.$v['id']); ?>"><?php showImage($v['mid_logo']);?></a></dt>
                            <dd class="name"><a href="<?php echo U('goods?id='.$v['id']); ?>"><?php echo $v['goods_name'];?></a></dd>
                            <dd class="price">特价：<strong>￥<?php echo $v['shop_price'];?></strong></dd>
                            <dd class="buy"><a href="<?php echo U('Index/goods?id='.$v['id']);?>"><span>立即抢购</span></a></dd>
                        </dl>
                    </li>
                    <?php endforeach; ?>
                </ul>
            </div>
            <!-- 热卖推荐 end -->

        </div>
        <!-- 热卖、促销 end -->

        <div style="clear:both;"></div>
        <div id="search_condition">
            当前搜素条件：
            <?php
                $brandId = I('get.brand_id');
                if($brandId): ?>
                    <span>
                        品牌：<?php echo ltrim(strstr($brandId,'-'),'-'); ?>
                        <a href="<?php echo filterUrl('brand_id'); ?>">X</a>
                    </span>
                <?php endif; ?>
            <?php
                $price = I('get.price');
                if($price): ?>
                    <span>
                        价格：<?php echo $price; ?>
                        <a href="<?php echo filterUrl('price'); ?>">X</a>
                    </span>
                <?php endif; ?>
            <?php
                foreach($_GET as $k => $v):
                    if(strpos($k,'attr_') === 0):
                        $_attrName = strrchr($v,'-');//取出属性名称
            ?>
            <span>
                <?php echo ltrim($_attrName,'-'); ?>:<?php echo str_replace($_attrName,'',$v); ?>
                <a href="<?php echo filterUrl($k); ?>">X</a>
            </span>
            <?php endif; endforeach; ?>
        </div>
        <!-- 商品筛选 start -->
        <div class="filter mt10">
            <h2> <strong>商品筛选</strong></h2>
            <div class="filter_wrap">
                <?php if(!I('get.brand_id')): ?>
                <dl>
                    <dt>品牌：</dt>
                    <?php foreach($searchFilter['brand'] as $k => $v):  ?>
                    <dd><a href="__SELF__/brand_id/<?php echo $v['brand_id']; ?>-<?php echo $v['brand_name']; ?>"><?php echo $v['brand_name']; ?></a></dd>
                    <?php endforeach; ?>
                </dl>
                    <?php endif; ?>
                <?php if(!I('get.price')): ?>
                <dl>
                    <dt>价格：</dt>
                    <?php foreach($searchFilter['price'] as $k => $v): ?>
                    <dd><a href="__SELF__/price/<?php echo $v; ?>"><?php echo $v; ?></a></dd>
                    <?php endforeach; ?>
                </dl>
                <?php endif; ?>
                <!--筛选属性-->
                <?php foreach($searchFilter['gaData'] as $k => $v):
                    $attrUrlName = 'attr_'.$v[0]['attr_id'];
                    if(isset($_GET[attrUrlName]))
                        continue;
                ?>
                <dl>
                    <dt><?php echo $k; ?>：</dt>
                    <?php foreach($v as $k1 => $v1): ?>
                    <dd><a href="__SELF__/<?php echo $attrUrlName; ?>/<?php echo $v1['attr_value']; ?>-<?php echo $k; ?>"><?php echo $v1['attr_value']; ?></a></dd>
                    <?php endforeach; ?>
                </dl>
                <?php endforeach; ?>
            </div>
        </div>
        <!-- 商品筛选 end -->

        <div style="clear:both;"></div>

        <!-- 排序 start -->
        <?php $odby = I('get.odby','xl'); ?>
        <div class="sort mt10">
            <dl>
                <dt>排序：</dt>
                <dd <?php if($odby=='xl') echo 'class="cur"'; ?>><a href="<?php echo filterUrl('odby'); ?>/odby/xl">销量</a></dd>
                <dd <?php if(strpos($odby,'price_')===0) echo 'class="cur"'; ?>>
                <a href="<?php echo filterUrl('odby'); ?>/odby/<?php echo $odby=='price_desc'?'price_asc':'price_desc'; ?>">
                    价格
                    <?php if(strpos($odby,'price_')===0): ?>
                        <?php echo $odby == 'price_asc' ? '↓' : '↑'; ?>
                    <?php endif; ?>
                </a></dd>
                <dd <?php if($odby=='addtime') echo 'class="cur"'; ?>><a href="<?php echo filterUrl('odby'); ?>/odby/addtime">上架时间</a></dd>
                <dd><a href="">评论数</a></dd>
            </dl>
        </div>
        <!-- 排序 end -->

        <div style="clear:both;"></div>

        <!-- 商品列表 start-->
        <div class="goodslist mt10">
            <ul>
                <?php foreach($data as $k => $v): ?>
                <li>
                    <dl>
                        <dt><a href="<?php echo U('Index/goods/?id='.$v['id']); ?>"><?php showImage($v['mid_logo']); ?></a></dt>
                        <dt><a href="<?php echo U('Index/goods/?id='.$v['id']); ?>"><?php echo $v['goods_name']; ?></a></dt>
                        <dt><strong>￥<?php echo $v['shop_price']; ?></strong></dt>
                        <dt><a href=""><em>已有10人评价</em></a>
                            <a href=""><em>已有<?php echo (int)$v['xl']; ?></em></a>
                        </dt>
                    </dl>
                </li>
                <?php endforeach; ?>
            </ul>
        </div>
        <!-- 商品列表 end-->

        <!-- 分页信息 start -->
        <div class="page mt20">
            <ul>
                <li >{$page}</li>
            </ul>
        </div>
        <!-- 分页信息 end -->

    </div>
    <!-- 列表内容 end -->
</div>
<!-- 列表主体 end-->

<script>
    <?php $config = C('IMAGE_CONFIG'); ?>
    var viewPath = '<?php echo $config['viewPath']; ?>';
    //记录浏览历史
    $.ajax({
        type:"GET",
        url : "<?php echo U('Index/displayHistory?id='.$info['id']);?>",
        dataType : "json",
        success : function (data)
        {
            var html = "";
            $(data).each(function(k,v)
            {
                html += '<dl><dt><a href="<?php echo U('goods','',false); ?>/id/'+v.id+'"><img src="'+viewPath+v.mid_logo+'"/></a></dt><dd>' + '<a href="<?php echo U('goods','',false); ?>/id/'+v.id+'">'+v.goods_name+'</a></dd></dl>'
            });
            $("#display_history").html(html);
        }
    });
</script>

<include file="Common/help"/>

